package com.itheima.a05myset;

import java.util.HashMap;
import java.util.HashSet;

public class A03_HashSetDemo2 {
    public static void main(String[] args) {

        //1.创建学生对象
        Student s1 = new Student("zhangsan", 23);
        Student s2 = new Student("lisi", 24);
        Student s3 = new Student("wangwu", 25);
        Student s4 = new Student("zhangsan", 23);

        //2.把学生添加到HashSet集合中
        HashSet<Student> stu = new HashSet<>();

        //3.添加元素并打印
        System.out.println(stu.add(s1));
        System.out.println(stu.add(s2));
        System.out.println(stu.add(s3));
        System.out.println(stu.add(s4));

        System.out.println(stu);

    }
}
